#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <stdexcept>
#include <string>
#include <sstream>

using std::cin, std::cout, std::string;
typedef unsigned long long ull;

template<class T,size_t size>
struct Array{
    constexpr Array(){};
    constexpr Array(const std::initializer_list<T> list){
        std::copy(list.begin(),list.end(),arr);
    }

    #ifdef NDEBUG
        #define NDB_NOEXCEPT noexcept
        #define NDB_CONSTEXPR constexpr
    #else
        #define NDB_NOEXCEPT
        #define NDB_CONSTEXPR
    #endif
    
    NDB_CONSTEXPR T& operator[](const size_t n)NDB_NOEXCEPT{
        #ifndef NDEBUG
            if(n>=size){
                std::ostringstream err_oss;
                err_oss<<"\n[array_size]: "<<size<<"\n[Your index]: "<<n<<'\n';
                throw std::runtime_error(err_oss.str());
            }
        #endif
        return arr[n];
    }
    struct Iterator{
        constexpr Iterator(const size_t n,T *const p)noexcept:now{n},p{p}{}
        bool operator!=(const Iterator &that)const noexcept{
            return this->now!=that.now;
        }
        NDB_CONSTEXPR T& operator*()const NDB_NOEXCEPT{
            #ifndef NDEBUG
                if(now>=size){
                    std::ostringstream err_oss;
                    err_oss<<"[array_size]: "<<size<<" [Your index]: "<<now<<'\n';
                    throw std::runtime_error(err_oss.str());
                }
            #endif
            return p[now];
        }
        constexpr Iterator& operator++()noexcept{
            now++;
            return *this;
        }
        constexpr Iterator& operator--()noexcept{
            now--;
            return *this;
        }
        constexpr Iterator operator--(int)noexcept{
            auto old = *this;
            now--;
            return old;
        }
    private:
        size_t now;
        T *const p;
    };
    constexpr Iterator begin()noexcept{
        return Iterator(0,arr);
    }
    constexpr Iterator end()noexcept{
        return Iterator(size,arr);
    }
private:
    T arr[size];
};

template<class T,class ...Args>
constexpr static Array<T,sizeof...(Args)> make_array(Args&&...args){
    Array<T,sizeof...(Args)> arr;
    size_t index {0};
    ((arr[index++]=args),...);
    return arr;
}

static const size_t MOD {998244353}, MAX_N {300000+5};
static string s;
static size_t unused_left_num, ans;
static Array<size_t,MAX_N>  left_dp, last_left;
static Array<ull,MAX_N> stk;

int main(){
    cin>>s;
    for(size_t i {1};i<=s.size();i++){
        if(s[i-1]=='('){
            stk[unused_left_num++]=i;
        }else if(unused_left_num>0){
            last_left[i] = stk[--unused_left_num];
            left_dp[i] = (left_dp[last_left[i]-1] + last_left[i]) % MOD;
            ans = (ans + left_dp[i] * (s.size() - i+1)) % MOD ;
        }
    }
    cout<<ans<<'\n';
}